<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------


// [ 应用入口文件 ]
error_reporting(E_ERROR | E_PARSE);
ini_set('display_errors', 'Off');
// 定义应用目录
define('APP_PATH', __DIR__ . '/application/');

// CORS 设置
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");



if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    http_response_code(200);
    exit();
}

//获取当前脚本路径
if($_SERVER['SCRIPT_NAME']!="/index.php"){
    define('ROOT',dirname($_SERVER['SCRIPT_NAME']));
}else{
    define('ROOT',"");
}

// 加载框架引导文件
require __DIR__ . '/thinkphp/start.php';
